package com.example.administrator.myapplication;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import com.example.administrator.myapplication.service.InitSettings;

/**
 * Created by Administrator on 2017/8/3 0003.
 * 通用Activity
 */

public class MyBaseActivity extends AppCompatActivity {
    private boolean transverse_screen_state;
    private static final String TAG = "MyBaseActivity";
    @Override
    protected void onStart() {
        super.onStart();

    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
      /*  SharedPreferences sharedPreferences = this.getSharedPreferences(GloabSettings.SETTINGS_GLOAB, 0);
        transverse_screen_state =  sharedPreferences.getBoolean(GloabSettings.Transverse_screen_state_NAME, false);
        if(transverse_screen_state){
            Log.i(TAG, "初始化屏幕方向为横向！");
            this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        }else {
            Log.i(TAG, "初始化屏幕方向为纵向！");
            this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

        }*/

      InitSettings initSettings = InitSettings.getInstance(this);
        initSettings.init_transverse_screen_state();

    }
    private Toast toast = null;

    public Toast showToastMake(CharSequence message){
        if(toast!=null){
            toast.setText(message);
        }else {
            toast = Toast.makeText(MyBaseApplication.getContextObject(),message,Toast.LENGTH_SHORT);
        }
        return toast;
    }

}
